package com.diandian.backend.dingding.data.dto;

import com.diandian.base.boot.starter.exception.DefaultException;
import com.fasterxml.jackson.annotation.JsonFormat;

import java.io.Serializable;
import java.util.Date;

public class DingdingStaffExtendSyncParamDTO implements Serializable {

	private String belong;
	private String syncUserId;
	private String syncUserName;
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date syncTime;
	private String orgId;
	private String orgCode;
	private String userId;
	private String star;
	private String xinghuoTier;
	private String recommendBrand;
	private String status;

	public void check(){
		if(this.belong == null || "".equals(this.belong)){
			throw new DefaultException("归属标识不能为空");
		}
		if(this.userId == null || "".equals(this.userId)){
			throw new DefaultException("用户id不能为空");
		}
	}

	public DingdingStaffExtendAddParamDTO toDingdingStaffExtendAddParamDTO(){
		DingdingStaffExtendAddParamDTO result = new DingdingStaffExtendAddParamDTO();
		result.setBelong(this.belong);
		result.setCreateUserId(this.syncUserId);
		result.setCreateUserName(this.syncUserName);
		if(this.syncTime != null){
			result.setCreateTime(this.syncTime);
		} else {
			result.setCreateTime(new Date());
		}
		result.setOrgId(this.orgId);
		result.setOrgCode(this.orgCode);
		result.setUserId(this.userId);
		result.setStar(this.star);
		result.setXinghuoTier(this.xinghuoTier);
		result.setRecommendBrand(this.recommendBrand);
		result.setStatus(this.status);
		return result;
	}
	public DingdingStaffExtendUpdateByIdParamDTO toDingdingStaffExtendUpdateByIdParamDTO(Long id){
		DingdingStaffExtendUpdateByIdParamDTO result = new DingdingStaffExtendUpdateByIdParamDTO();
		result.setId(id);
		result.setBelong(this.belong);
		result.setOrgId(this.orgId);
		result.setOrgCode(this.orgCode);
		result.setUpdateUserId(this.syncUserId);
		result.setUpdateUserName(this.syncUserName);
		if(this.syncTime != null){
			result.setUpdateTime(this.syncTime);
		} else {
			result.setUpdateTime(new Date());
		}
		result.setUserId(this.userId);
		result.setStar(this.star);
		result.setXinghuoTier(this.xinghuoTier);
		result.setRecommendBrand(this.recommendBrand);
		result.setStatus(this.status);
		return result;
	}

	public String getBelong() {
		return belong;
	}

	public void setBelong(String belong) {
		this.belong = belong;
	}

	public String getSyncUserId() {
		return syncUserId;
	}

	public void setSyncUserId(String syncUserId) {
		this.syncUserId = syncUserId;
	}

	public String getSyncUserName() {
		return syncUserName;
	}

	public void setSyncUserName(String syncUserName) {
		this.syncUserName = syncUserName;
	}

	public Date getSyncTime() {
		return syncTime;
	}

	public void setSyncTime(Date syncTime) {
		this.syncTime = syncTime;
	}

	public String getOrgId() {
		return orgId;
	}

	public void setOrgId(String orgId) {
		this.orgId = orgId;
	}

	public String getOrgCode() {
		return orgCode;
	}

	public void setOrgCode(String orgCode) {
		this.orgCode = orgCode;
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getStar() {
		return star;
	}

	public void setStar(String star) {
		this.star = star;
	}

	public String getXinghuoTier() {
		return xinghuoTier;
	}

	public void setXinghuoTier(String xinghuoTier) {
		this.xinghuoTier = xinghuoTier;
	}

	public String getRecommendBrand() {
		return recommendBrand;
	}

	public void setRecommendBrand(String recommendBrand) {
		this.recommendBrand = recommendBrand;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}
}
